"""sync models

Revision ID: f377d5ab37ec
Revises: 
Create Date: 2025-12-03 10:12:38.841741

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = 'f377d5ab37ec'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('fenbaos',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('professional', sa.String(), nullable=False),
    sa.Column('staff_count', sa.Integer(), nullable=False),
    sa.Column('level', sa.String(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('fenbao_projects',
    sa.Column('fenbao_id', sa.Integer(), nullable=False),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['fenbao_id'], ['fenbaos.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
    sa.PrimaryKeyConstraint('fenbao_id', 'project_id'),
    sa.UniqueConstraint('fenbao_id', 'project_id', name='uq_fenbao_project')
    )
    # intentionally keep existing 'apscheduler_jobs' table if present
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('fenbao_projects')
    op.drop_table('fenbaos')
    # ### end Alembic commands ###
